var page_ns_prefixes= {
'en':'Page',
'fr':'Page',
'de':'Seite',
'it':'Pagina',
'la':'Pagina',
'no':'Side',
'es':'Página',
'pt':'Página',
'sv':'Sida',
'pl':'Strona',
'hy':'Էջ',
'ru':'Страница',
'hr':'Stranica',
'hu':'Oldal',
'ca':'Pàgina',
'vi':'Trang',
'sl':'Stran',
'zh':'Page'
}
var index_ns_prefixes= {
'en':'Index',
'fr':'Livre',
'de':'Index',
'it':'Indice',
'la':'Liber',
'no':'Indeks',
'es':'Índice',
'pt':'Galeria',
'sv':'Index',
'hy':'Ինդեքս',
'ru':'Индекс'
}
function pr_msg(mlist) {
var msg = mlist[wgContentLanguage];
if(!msg) msg = mlist['en'];
return msg;
}
function get_optlist() {
var message_optlist={ 'en':'display options' , 'fr':'options d’affichage' }
var optlist = document.getElementById("optlist");
if(!optlist) {
var displayOptions = document.createElement("div");
displayOptions.style.marginTop = "0.7em";
displayOptions.className = "portal";
if (self.skin=='vector') cl="body"; else cl="pBody";
displayOptions.innerHTML = '
'+pr_msg(message_optlist)+'<\/h5><\/div>';
document.getElementById("p-tb").appendChild(displayOptions);
optlist = document.getElementById("optlist");
}
return optlist;
}
/*** Cookies ***/
function SetCookie(name,value) {
document.cookie = name + "=" + escape(value);
}
function GetCookie(name) {
var i =0;
while (i < document.cookie.length) {
if (document.cookie.substr(i,name.length) == name) {
var valend = document.cookie.indexOf(";",i+name.length+1);
if (valend == -1) {
valend = document.cookie.length;
}
return unescape(document.cookie.substring(i+name.length+1,valend));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
}
/**** Display options ****/
function OptionText() {
var indexNavigationBar = 0;
// iterate over all < span >-elements until class "OptionText" is found
for(
var i=0;
SpanElem = document.getElementsByTagName("span")[i];
i++
) {
// if found an option span
if (SpanElem.className == "OptionText") {
//SpanElem.style.display = 'none';
OptionTitle = SpanElem.title;
OptionStyle = SpanElem.firstChild.getAttribute('style');
//check if option was already encountered...
if(!document.getElementById(OptionTitle)){
//read cookie
var DisplayOptionDefault = true;
CookieDisplayOption = GetCookie ("Display"+OptionTitle)
if (CookieDisplayOption ) {
if (CookieDisplayOption == "false") DisplayOptionDefault = false; }
var PageDisplay = document.createElement("li");
PageDisplay.setAttribute('id', OptionTitle);
var PageDisplayLink = document.createElement("a");
OptionText = document.createTextNode("Désactiver "+OptionTitle);
PageDisplayLink.appendChild(OptionText);
PageDisplayLink.setAttribute('href','javascript:displayOptionText("'+OptionTitle+'","' + OptionStyle +'", '+DisplayOptionDefault+');');
PageDisplay.appendChild(PageDisplayLink);
var optlist = get_optlist();
optlist.appendChild(PageDisplay);
displayOptionText(OptionTitle,OptionStyle,DisplayOptionDefault);
}
}
}
}
function displayOptionText(optiontitle, optionstyle, bool) {
SetCookie ("Display"+optiontitle,bool);
var PageDisplayLink = document.getElementById(optiontitle).firstChild;;
// iterate over all < span >-elements
for(
var i=0;
SpanElem = document.getElementsByTagName("span")[i];
i++
) {
// if found an option text
if ((SpanElem.className == "OptionText") && (SpanElem.title == optiontitle)) {
if(bool==true ) {
SpanElem.setAttribute('style',optionstyle);
PageDisplayLink.firstChild.data = (optiontitle);
PageDisplayLink.setAttribute('href', 'javascript:displayOptionText("'+optiontitle+'","'+optionstyle+'", false);');
}
if(bool==false) {
SpanElem.setAttribute('style','null');
PageDisplayLink.firstChild.data = (optiontitle);
PageDisplayLink.setAttribute('href', 'javascript:displayOptionText("'+optiontitle+'","'+optionstyle+'", true);');
}
}
}
}
addOnloadHook(OptionText);